package com.it.service.impl;

import com.it.service.TeacherService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.stereotype.Service;

/**
 * @Author: CaoYouGen
 * @DateTime: 2023/11/08/14:19
 * @注释: TODO
 **/

@Service
@Slf4j
public class TeacherServiceImpl implements TeacherService {

    @Override
    @PreAuthorize("hasAuthority('teacher:add')") // 预授权 // hasAuthority('teacher:add') 一个权限可访问
    public String add() {
        log.info("添加教师成功!");
        return "添加教师成功!";
    }

    @Override
    @PreAuthorize("hasAnyAuthority('teacher:delete')") // hasAnyAuthority('teacher:add','teacher:delete'...) 可以有多权限
    public String delete() {
        log.info("删除教师成功!");
        return "删除教师成功!";
    }

    @Override
    @PreAuthorize("hasAnyAuthority('teacher:update')")
    public String update() {
        log.info("修改教师成功!");
        return "修改教师成功!";
    }

    @Override
    @PreAuthorize("hasAnyAuthority('teacher:query')")
    public String query() {
        log.info("查询教师成功!");
        return "查询教师成功!";
    }
}
